/*Replication materials for:
Velasco, Kristopher. "A Growing Queer Divide: 
The Divergence between Transnational Advocacy Networks and Foreign Aid in Diffusing LGBT Policies
*/

use "Velasco_Queer Divide_Data.dta", clear

*Table 2. Two-Way Fixed-Effects Models Predicting LGBT Policy Index, 1990-2016
	*Model 1) Baseline Model: Global Context
	xtreg policy_index c.global_lgbt_context other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization i.year, fe vce(cluster recipient)

	*Model 2) Transnational Advocacy Networks
		*2a) INC Scores; No Interaction
		xtreg policy_index c.global_lgbt_context c.z_lgbt_inc_score other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization i.year, fe vce(cluster recipient)

		*2b) INC Scores; Interaction
		xtreg policy_index c.global_lgbt_context##c.z_lgbt_inc_score other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization i.year, fe vce(cluster recipient)

		*3a) In-Degree; No Interaction
		xtreg policy_index c.global_lgbt_context c.z_lgbt_indegree other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization i.year, fe vce(cluster recipient)

		*3b) In-Degree; Interaction
		xtreg policy_index c.global_lgbt_context##c.z_lgbt_indegree other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization i.year, fe vce(cluster recipient)

	*Model 3) Foreign Aid
		*4a) Net ODA; No Interaction
		xtreg policy_index c.global_lgbt_context c.z_percent_oda_ln other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization i.year, fe vce(cluster recipient)

		*4b) Net ODA; Interaction
		xtreg policy_index c.global_lgbt_context##c.z_percent_oda_ln other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization i.year, fe vce(cluster recipient)

		*5a) In-Degree; No Interaction
		xtreg policy_index c.global_lgbt_context c.z_oecd_donor_indegree other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization i.year, fe vce(cluster recipient)

		*5b)  In-Degree; Interaction 
		xtreg policy_index c.global_lgbt_context##c.z_oecd_donor_indegree other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization i.year, fe vce(cluster recipient)


*Figure 1. Changes in Selected LGBT Policies in Non-OECD States, 1990-2016
twoway ///
	(mspline  count_samesex_legal year, ///
		title("Figure 1. Change in Selected LGBT Policies", size(medlarge) color(black)) ///
		subtitle("1990-2016", size(medsmall)) ///
		ytitle("Number of Non-OECD States with Specified Policy") ///
		legend(label(1 "Same-Sex Acts Legal") size(vsmall) cols(3) symxsize(*.5))) ///
	(mspline count_employ_discrim year, ///
		legend(label(2 "Employment Discrimination Ban"))) ///
	(mspline count_hate_crimes year, ///
		legend(label(3 "Hate Crime Protections"))) ///
	(mspline count_marriage year, ///
		legend(label(4 "Same-Sex Marriage"))) /// 
	(mspline count_propaganda year, ///
		legend(label(5 "Anti-Propaganda Laws")))

		   

*Figure 2. Marginal Effects Plots
xtreg policy_index c.global_lgbt_context##c.z_lgbt_inc_score other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization, fe vce(cluster recipient)
margins, dydx(z_lgbt_inc_score) at(global_lgbt_context=(0(2)28)) saving(lgbt_ingo, replace)
marginsplot 

xtreg policy_index c.global_lgbt_context##c.z_lgbt_indegree other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization, fe vce(cluster recipient)
margins, dydx(z_lgbt_indegree) at(global_lgbt_context=(0(2)28)) saving(lgbt_ingo2, replace)
marginsplot

xtreg policy_index c.global_lgbt_context##c.z_percent_oda_ln other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization, fe vce(cluster recipient)
margins, dydx(z_percent_oda_ln) at(global_lgbt_context=(0(2)28)) saving(aid, replace)
marginsplot

xtreg policy_index c.global_lgbt_context##c.z_oecd_donor_indegree other_donors women_parliament demo_inverse_FH loggdp_cap logpopden cultural_globalization, fe vce(cluster recipient)
margins, dydx(z_oecd_donor_indegree) at(global_lgbt_context=(0(2)28)) saving(aid2, replace)
marginsplot

combomarginsplot aid aid2 lgbt_ingo lgbt_ingo2, noci
